<template>
  <div class="contact">
      <div class="land">

        <div class="contain">
          <div class="brief">
              <h1>
              Contact Us
              </h1>
              Let us know if you have any questions about our product or if you are interested in partnering with us. We will get back to you as soon as possible. 
          </div>
          <div class="cloud">
          </div>
        </div>

        <div class="forms">
          <div class="l">
            <h1>CONTACT DETAILS</h1>
            <div>
              <i></i>
              <aside>
                <p>Mail</p>
                <span>team@frontrock.io</span>
              </aside>
            </div>
            <div>
              <i></i>
              <aside>
                <p>Phone</p>
                <span>659-657-0133</span>
              </aside>
            </div>
          </div>
          <div class="r">
            <el-form :model="ruleForm" :rules="rules" 
            hide-required-asterisk label-position="top" 
            ref="ruleForm" class="demo-ruleForm">
              <el-form-item label="Your Email Address" prop="email">
                <el-input v-model="ruleForm.email" placeholder="Enter your email"></el-input>
              </el-form-item>
              <el-form-item label="Subject" prop="subject">
                <el-input v-model="ruleForm.subject" placeholder="Enter the subject"></el-input>
              </el-form-item>
              <el-form-item label="Message" prop="msg">
                <el-input type="textarea" v-model="ruleForm.msg" placeholder="Your message starts here…"></el-input>
              </el-form-item>
              <!-- <el-form-item label="活动区域" prop="region">
                <el-select v-model="ruleForm.region" placeholder="请选择活动区域">
                  <el-option label="区域一" value="shanghai"></el-option>
                  <el-option label="区域二" value="beijing"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="活动时间" required>
                <el-col :span="11">
                  <el-form-item prop="date1">
                    <el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 100%;"></el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col class="line" :span="2">-</el-col>
                <el-col :span="11">
                  <el-form-item prop="date2">
                    <el-time-picker placeholder="选择时间" v-model="ruleForm.date2" style="width: 100%;"></el-time-picker>
                  </el-form-item>
                </el-col>
              </el-form-item>
              <el-form-item label="即时配送" prop="delivery">
                <el-switch v-model="ruleForm.delivery"></el-switch>
              </el-form-item>
              <el-form-item label="活动性质" prop="type">
                <el-checkbox-group v-model="ruleForm.type">
                  <el-checkbox label="美食/餐厅线上活动" name="type"></el-checkbox>
                  <el-checkbox label="地推活动" name="type"></el-checkbox>
                  <el-checkbox label="线下主题活动" name="type"></el-checkbox>
                  <el-checkbox label="单纯品牌曝光" name="type"></el-checkbox>
                </el-checkbox-group>
              </el-form-item>
              <el-form-item label="特殊资源" prop="resource">
                <el-radio-group v-model="ruleForm.resource">
                  <el-radio label="线上品牌商赞助"></el-radio>
                  <el-radio label="线下场地免费"></el-radio>
                </el-radio-group>
              </el-form-item> -->
              <el-form-item>
                <el-button type="primary" @click="submitForm('ruleForm')">Submit</el-button>
                <el-button @click="resetForm('ruleForm')">Reset</el-button>
              </el-form-item>
            </el-form>
          </div>
        </div>

      </div>
  </div>
</template>

<script>
//   import tokensCard from './tokensCard'
export default {
    name: 'contact',
    data() {
      const checkEmail = (rule, value, callback) => {
      const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
      setTimeout(() => {
        if (mailReg.test(value)) {
          callback()
        } else {
          callback(new Error('Please enter a valid email address'))
        }
      }, 100)
    }
      return {
        articles: [],
        state: '',
        timeout:  null,
        ruleForm: {
          name: '',
          email: '',
          subject: '',
          msg: ''
          // region: '',
          // date1: '',
          // date2: '',
          // delivery: false,
          // type: [],
          // resource: ''
        },
        rules: {
          name: [
            { required: true, message: 'Please enter a name', trigger: 'blur' }
          ],
          email: [
            { required: true, message: 'Please enter a email address', trigger: 'blur' },
            { validator: checkEmail, trigger: 'blur', required: true }
          ],
          subject: [
            { required: true, message: 'Please enter a subject', trigger: 'blur' }
          ],
          msg: [
            { required: true, message: 'Please enter your message', trigger: 'blur' },
            { min: 3, max: 200, message: 'Character limit is between 3 and 200', trigger: 'blur' }
          ]
          // region: [
          //   { required: true, message: '请选择活动区域', trigger: 'change' }
          // ],
          // date1: [
          //   { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          // ],
          // date2: [
          //   { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
          // ],
          // type: [
          //   { type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
          // ],
          // resource: [
          //   { required: true, message: '请选择活动资源', trigger: 'change' }
          // ],
        }
      }
    },
    components: {
    //   tokensCard
    },
    mounted() {
        console.log('contact:', this)
    },
    methods: {
        routePath(i) {
            Bus.$emit('topbar', i)
        },
        salesBuy() {
            console.log(Date())
        },
        submitForm(formName) {
          this.$refs[formName].validate((valid) => {
            if (valid) {
              this.$message.success('submit!')
              this.resetForm('ruleForm')
            } else {
              console.log('error submit!!')
              // this.$message.success('error submit!')
              return false
            }
          });
        },
        resetForm(formName) {
          this.$refs[formName].resetFields()
        }
    }
}
</script>


<style scoped="scoped" lang="scss">
  .contact {
    position: relative;
    text-align: center;
    // min-height: 400px;
    // margin: 50px auto 0 auto;
    // background: #EF6566;
    color: #fff;
    .land{
      font-family: Newsreader, serif;
      width: 100%;
      display: inline-block;
      .contain{
        // height: 660px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: left;
        @media screen and (max-width: 720px) {
          // height: 360px;
          padding-bottom: 100px;
          flex-direction: column-reverse;
        }
        .brief{
            width: 30%;
            font-size: 16px;
            line-height: 22px;
            h1{
              font-size: 48px;
              font-weight: 900;
              line-height: 52px;
            }
            .search{
                margin: 80px 0 0 0;
                display: flex;
                align-items: center;
                .el-input{
                    .el-input__inner{
                        // height: 82px !important;
                        // width: 50% !important;
                    }
                }
                .buttons{
                    padding: 0;
                    text-align: center;
                    margin:0 0 0 -160px;
                    z-index: 100;
                    a{
                        width: 140px;
                        padding: 2px 0 14px 0;
                    }
                }
            }
            @media screen and (max-width: 720px) {
                width: 90%;
                letter-spacing:1px;
                h1{
                  font-size: 36px;
                  letter-spacing: 0;
                }
            }
        }
        .cloud{
            background: url(../assets/blog_bg.png) no-repeat;
            background-size:auto 100%;
            background-position: center 50%;
            width: 56%;
            height: 500px;
            @media screen and (max-width: 720px) {
              width: 90%;
              height: 240px;
              left: -50px;
              right: -50px;
            }
        }
      }
      
      .forms{
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        padding: 80px 0 160px 0;
        text-align: left;
        .l, .r{
          border-radius: 25px;
          max-width: 360px;
          // height: 240px;
          position: relative;
          // margin:0 0px 0 80px;
          color:#070F4E;
          &.l{
            width: 30%;
            margin-right: 9%;
            h1{
              margin-bottom: 50px;
              font-weight: 100;
            }
            div{
              display: flex;
              align-items: center;
              line-height: 30px;
              margin: 0 0 40px 0;
              i{
                background: url(../assets/phone_ico.png), #EF6566;
                background-repeat: no-repeat;
                background-size: auto 50%;
                background-position: center center;
                width: 50px;
                height: 50px;
                border-radius: 50%;
                display: inline-block;
                margin: 0 25px 0 0;
              }
              aside{
                font-family: "Krona One", monospace;
                p{
                  margin:0;
                  font-size: 15px;
                  font-weight: bold;
                }
                span{
                  font-family: Newsreader, serif;
                  font-size: 15px;
                }
              }
            }
          }
          &.r{
            .form{
              width:600px;
            }
            .buttons{

            }
          }
        }
        @media screen and (max-width: 720px) {
          flex-direction: column;
          .l, .r{
            width: 80% !important;
            margin: 0 !important;
            h1{
              font-size: 26px;
              text-align: center;
            }
            &.r{
              // width:40% !important;
            }
          }
        }
      }
    }
  }

@media only screen and (min-width: 1680px) {
  .order{
    font-size: 16px;
    font-weight: bold;
    color:white;
    position: absolute;
    right: 2%;
    top: 28%;
    .r{
      font-size: 45px;
      em{
        font-size: 20px;
        font-style: normal;
      }
    }
    .btn {
      font-size: 22px;
    }
  }
}
@media only screen and (min-width: 1570px) and (max-width: 1680px) {
  .order{
    font-size: 16px;
    font-weight: bold;
    color:white;
    position: absolute;
    right: 2%;
    top: 28%;
    .r{
      font-size: 45px;
      em{
        font-size: 20px;
        font-style: normal;
      }
    }
    .btn {
      font-size: 22px;
    }
  }
}
@media only screen and (min-width: 1440px) and (max-width: 1570px) {
  .order{
    font-size: 14px;
    font-weight: bold;
    color:white;
    position: absolute;
    right: 3%;
    top: 36%;
    .r{
      font-size: 38px;
      em{
        font-size: 15px;
        font-style: normal;
      }
    }
    .btn {
      font-size: 21px;
    }
  }
}
@media only screen and (max-width: 1440px) {
  .order{
    font-size: 14px;
    font-weight: bold;
    color:white;
    position: absolute;
    right: 2%;
    top: 40%;
    .r{
      font-size: 30px;
      em{
        font-size: 14px;
        font-style: normal;
      }
    }
  }
}
@media only screen and (max-width: 720px) {
  .order {
    font-size: 14px;
    font-weight: bold;
    color:white;
    position: absolute;
    right: 2%;
    top: 0;
    .r {
      font-size: 30px;
      em {
        font-size: 14px;
        font-style: normal;
      }
    }
    .btn {
      font-size: 16px;
      margin-left: 1px;
    }
  }
}
@media only screen and (max-width: 420px) {
  .order {
    top: 4px;
    right: 1.5%;
    a {
      font-size: 16px;
      transform: translateY(-6px);
    }
    .r {
      font-size: 24px;
    }
    .btn {
      padding: 0.18em 0.6em 0.19em;
      font-size: 15px;
    }
  }
}
@media only screen and (max-width: 375px) {
  .order {
    top: 0px;
    right: 1.5%;
    a {
      font-size: 16px;
      transform: translateY(-6px);
    }
    .r {
      font-size: 18px;
    }
    .btn {
      padding: 0.12em 0.3em 0.13em;
      font-size: 15px;
      margin-left: 0;
    }
  }
}
@media only screen and (max-width: 360px) {
  .order {
    top: -1px;
    a {
      font-size: 16px;
      transform: translateY(-6px);
    }
    .r {
      font-size: 18px;
    }
    .btn {
      padding: 0.12em 0.3em 0.13em;
      font-size: 15px;
      margin-left: 0;
    }
  }
}
</style>


<style lang="scss">
.contact{
    .brief{
        .search{
            .el-input{
                .el-input__inner{
                    border:none;
                    height: 65px;
                    width: 600px;
                    font-size: 18px;
                    border-radius: 35px;
                    padding: 4px 0  0 60px;
                    font-family: Newsreader, serif;
                    font-weight: 100;
                }
                .el-icon-search{
                  transform: scale(1.3);
                  color: #070F4E;
                  font-weight: bold;
                  margin: 0 10px;
                }
            }
        }
    }
    .forms{
      .el-form{
        width:500px;
        .el-form-item__label{
          color:#070F4E;
          font-family: "Krona One", monospace;
          padding: 0;
        }
        .el-input{
          input{
            font-family: Newsreader, serif;
            color: #606266;
          }
        }
        .el-textarea{
          textarea{
            min-height: 160px !important;
          }
        }
        .el-form-item__content{
          button{
            width: 40%;
            height: 40px;
            box-sizing: border-box;
            border: 1px solid #EF6566;
            box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.2);
            border-radius: 44px;
            color: white;
            font-family: "Krona One", monospace;
            font-size: 14px;
            text-decoration: none;
            display: inline-block;
            margin: 20px 20px 0 0;
            &.el-button--primary{
              background: #EF6566;
              &:hover{
                filter: brightness(1.1);
              }
            }
            &.el-button--default{
              border:1px solid;
              color:#EF6566;
              &:hover{
                background: rgba(239, 101, 102, .1);
              }
            }
            @media screen and (max-width: 640px) {
              width: 90%;
              margin:0;
            }
          }
        }
        @media screen and (max-width: 720px) {
          width:100%;
          button{
            margin: 10px 0 !important;
            width:100% !important;
          }
        }
      }
    }
}
</style>